﻿<?php
error_reporting(0);
define('IN_QY',true);
session_start();
require("include/common.inc.php");
define('SCRIPT','ad_list');
//
if(!$_COOKIE['userid']){
      echo "<script type='text/javascript'>location.href='/wap/mlogin.php';</script>";
      exit;
}

?>

<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>全部订单-众晒网</title>
    <link rel="stylesheet" type="text/css" href="/ui/css/Hui.css" />
    <style type="text/css">
    body#body {
    height: 100%;
}
    .H-theme-background-color9 {
    background-color: #ffffff;
}
.H-theme-font-color-white {
    color: black;
}
.H-theme-border-color9 {
    border: 1px solid #ffa200;
}
.H-theme-font-color9 {
    color: #ffa200;
}
button {
    background: #cccccc00;
    border-radius: 7px;
    border: 1px solid #828282;
    margin: 11px;
    font-size: 12px;
    width: 65px;
    height: 20px;
    line-height: 16px;
}
:focus {
    border-color: #ffa200;
    border-radius: 5px;
    outline: none;
    color: #ffa200;
}
    </style>
</head>
<body id="body">
    <header class="H-header H-theme-background-color9" id="header">
        <span tapmode="" onclick="H.openWin('my', 'my.php');" class="H-icon H-position-relative H-display-inline-block H-float-left H-vertical-middle H-theme-font-color-white H-padding-horizontal-left-5 H-z-index-100"><i class="H-iconfont H-icon-arrow-left H-font-size-18 H-vertical-middle"></i><label class="H-display-block H-vertical-middle H-font-size-15">返回</label></span>
        <div class="H-header-title H-center-all H-font-size-18 H-text-show-row-1 H-theme-font-color-white H-position-absolute H-width-100-percent">
            我的订单
        </div>
        <div class="H-flexbox-horizontal H-theme-background-color-white" id="tag">
            <div tapmode="" onclick="H.openWin('all', 'all.php');" class="H-flex-item H-center-all H-theme-font-color-666 H-padding-vertical-both-10 H-theme-border-color-white  H-font-size-16 H-theme-border-color-52ace5 H-theme-font-color-52ace5 H-theme-border-color9 H-theme-font-color9" style="border-width: 0 0 2px  0">
                全部
            </div>
            <div tapmode="" onclick="H.openWin('obligations', 'obligations.php');"  class="H-flex-item H-center-all H-theme-font-color-666 H-padding-vertical-both-10 H-theme-border-color-white  H-font-size-16" style="border-width: 0 0 2px  0">
                待付款
            </div>
            <div tapmode="" onclick="H.openWin('receipt', 'receipt.php');"  class="H-flex-item H-center-all H-theme-font-color-666 H-padding-vertical-both-10 H-theme-border-color-white  H-font-size-16" style="border-width: 0 0 2px  0">
                待收货
            </div>
            <div tapmode="" onclick="H.openWin('evaluated', 'evaluated.php');" class="H-flex-item H-center-all H-theme-font-color-666 H-padding-vertical-both-10 H-theme-border-color-white  H-font-size-1" style="border-width: 0 0 2px  0">
                待评价
            </div>
        </div>
    </header>

	
	
	    <div id="lis" class="H-padding-8">
	
	
  <?php

  	$reslut = "select count(*) as a from tbl_taorder where id in (select min(id) from tbl_taorder group by orderid ) AND (is_pay!=0 AND is_pay!=4 ) and is_pay!=0 and uid='".$_COOKIE['userid']."'";
  $query_reslut = mysql_query($reslut);
$row_reslut=mysql_fetch_array($query_reslut);
$count=$row_reslut['a'];
//页面数量
$page_size=3;
//总页数
$page_count = ceil($count/$page_size);
//第几页
$page=$_GET['page'];
if($page==''){
  $page=1;
}
$last=$page-1;//上一页
$next=$page+1;//下一页

//页面起始条数
$offset=$page_size*($page-1);
  
  
  
           $sql1 = "select * from tbl_taorder where id in (select min(id) from tbl_taorder group by orderid ) AND (is_pay!=0 AND is_pay!=4 ) and uid='".$_COOKIE['userid']."' order by id desc LIMIT $offset,$page_size";
           $query1 = mysql_query($sql1);
		
        if(!mysql_affected_rows()){
            echo '
                <div class="H-padding-vertical-bottom-10"></div>
                </br>
    <div class="H-channel-title H-flexbox-horizontal H-theme-background-color-white H-vertical-middle H-border-vertical-bottom-after">
        <div class="H-channel-line H-theme-background-color8 H-padding-vertical-top-15 H-padding-horizontal-left-3  H-margin-horizontal-left-10"></div>
        <div class="H-channel-text H-theme-font-color8 H-flex-item H-font-size-18 H-theme-font-color-black H-padding-10 H-margin-horizontal-right-10 H-text-show-row-1">暂无待支付商品</div>
    </div>
    </br></br>
            ';
}        
        while ($row=mysql_fetch_array($query1)) {
            
    ?>  
    <div id="lis" class="H-padding-8" style="width:96%;" >
        <div   id="list1" class="H-border-radius3-px H-theme-background-color-white H-margin-vertical-bottom-5 H-border-vertical-both-after H-border-horizontal-both-after" >

            <div onclick="H.openWin('paycontentao', 'paycontentao.php?fid=<?php echo $row['orderid'] ?>');"   class="H-padding-10 H-border-vertical-bottom-after H-flexbox-horizontal H-theme-font-color-999 H-font-size-14 H-flexbox-horizontal H-text-horizontal-left H-box-sizing-border-box">
            	<span class="H-font-size-10">订单号：<?=$row['orderid']?></span><span class="H-font-size-10 H-display-block H-flex-item H-text-align-right"><?php echo date("Y-m-d",$row['addtime'])  ?></span>
            </div>
			
			  <?php
		
  	   $reslut2 = "select count(*) as b from tbl_taorder where orderid='".$row['orderid']."' AND uid='".$_COOKIE['userid']."'";
       $query_reslut2 = mysql_query($reslut2);
       $row_reslut2=mysql_fetch_array($query_reslut2);
	   
	   $reslut3 = "select sum((totprice+expresstri)-yhqmoney) as c from tbl_taorder where orderid='".$row['orderid']."' AND uid='".$_COOKIE['userid']."'";
       $query_reslut3 = mysql_query($reslut3);
       $row_reslut3=mysql_fetch_array($query_reslut3);
	
        $sql2 = "select * from tbl_taorder  where uid='".$_COOKIE['userid']."' AND (is_pay!=0 AND is_pay!=4 )  AND orderid='".$row['orderid']."'";
        $query2=mysql_query($sql2);

		while ($row2=mysql_fetch_array($query2)) {    
      
    ?> 
	
	     <?php
       $sql3 = "select * from tbl_taospp  where id='".$row2['goodid']."'";
        $query3=mysql_query($sql3);
		$row3=mysql_fetch_array($query3);
		
		 
		 				if($row2['bunit']<1){
	               $a=explode(',', $row3['img']);			
				} else
				{
					
			$sqlimg="SELECT * FROM tbl_goods_sku WHERE id= '".$row2['bunit']."'";
			$rowimg= mysql_query($sqlimg);
			$rowall=mysql_fetch_array($rowimg);
			$a =explode(",", $rowall['sku_pic']);
			
				
				}
		 
		 
		 
		 ?>
		 
            <div onclick="H.openWin('paycontentao', 'paycontentao.php?fid=<?php echo $row['orderid'] ?>');" class="H-flexbox-horizontal H-theme-background-color-white H-border-vertical-bottom-after" >
                <div class="H-padding-vertical-both-10">
                    <img src="<?php echo $a[0] ?>" srcs="" alt="" title="" class="imgCache H-display-block H-margin-horizontal-left-10" style="width: 70px; height:70px;" />
                </div>
                <div    class="H-flex-item H-padding-10 ">
                    <strong class="H-font-weight-normal font-weight-500 H-font-size-12 H-theme-font-color-black H-display-block H-text-show-row-1"><?php echo $row3['chtitle'] ?></strong>
					  
                    <div class="H-font-size-10 H-theme-font-color-999 H-text-show-row-2">
                       <?php echo $row3['origin'] ?>,<?php echo $row3['brand'] ?>
                    </div>                     
                    <div class="H-font-size-10 H-theme-font-color-999 H-text-show-row-2">                 
                        购买数量:<strong><span class="H-font-size-14" style="color:#EE7942"><?php echo $row2['gnum'] ?></span></strong> 
                    </div> 
                    <div class="H-font-size-10 H-theme-font-color-999 H-text-show-row-2">                 
           					    <?php
					
					if($row2['bunit']>1){

								$sku_info_key =explode(",", $rowall['sku_info_key']);
		
			
			$sku_info_name =explode(",", $rowall['sku_info_name']);			
			
			foreach($sku_info_key as $skukey=>$value){
				if(strlen($skukey)<=0){
					continue;
				}else{
			$sqlskukey="SELECT sku_name FROM tbl_sku_key WHERE id= '".$value."'";
			$rowskukey= mysql_query($sqlskukey);
			$rowskukeyy=mysql_fetch_array($rowskukey);
			
			//echo  $rowskukeyy['sku_name'] ;
	
			
			$sqlskuvalue="SELECT sku_value FROM tbl_sku_value WHERE id= '".$sku_info_name[$skukey]."'";
			$rowskuvalue= mysql_query($sqlskuvalue);
			$rowskukeyvalue=mysql_fetch_array($rowskuvalue);				
				
				
		    	echo $rowskukeyy['sku_name'].":".$rowskukeyvalue['sku_value'].",";     
							  
				}
			
			          }
					}

					?>
					
					
					
					
					
					
					
					<?php if($row2['is_pay']==1){ ?>
					<?php if($row2['is_deliv']>2){ ?>						
					<span class="H-badge H-display-inline-block"><label class="H-display-inline-block H-vertical-middle H-theme-background-color4 H-theme-font-color-white H-font-size-12">订单已完成</label></span>
                    </div> 						
						<?php }?>

						
									<?php if($row2['is_deliv']<3){ ?>		
						
					<span class="H-badge H-display-inline-block"><label class="H-display-inline-block H-vertical-middle H-theme-background-color8 H-theme-font-color-white H-font-size-12">已支付</label></span>
                    </div> 
					
					<?php } ?>
	                     <?php } ?>
					<?php if($row2['is_pay']==2){ ?>
					<span class="H-badge H-display-inline-block"><label class="H-display-inline-block H-vertical-middle H-theme-background-color8 H-theme-font-color-white H-font-size-12">已取消</label></span>
                    </div> 					
					<?php } ?>
					
					<?php if($row2['is_pay']==3){ ?>
					<span class="H-badge H-display-inline-block"><label class="H-display-inline-block H-vertical-middle H-theme-background-color8 H-theme-font-color-white H-font-size-12">待支付</label></span>
                    </div> 					
					<?php } ?>					
					
                </div>
            </div>
			
			  <?php } ?>
			
			
			
            


       <!--################### 华丽的分割线 ###################-->
 
	  <!--################### 底部开始线 ###################-->
            
        </div>
 <div style="text-align: right; height: 45px; line-height: 42px;background: white;">共<?=$row_reslut2['b']?>件商品&nbsp;&nbsp;合计：<?=$row_reslut3['c']?>&nbsp;&nbsp;
 
     <div style="float: right;">               
     <button onclick="del('<?=$row['orderid']?>')">删除</button>
     </div>  

	 
 </div> 		
        </div>
        <?php } ?>

            <?php

    if($page==1){   
	if($page_count>$page){
		
	echo "<a href='?page=".$next."'  style='text-decoration:none; width: 47px;border: 1px solid;border-radius: 5px; border-style: -6px; padding: 5px;color: #fc8b4a;margin-left:43%;font-weight: 600;font-size: 14px; float:right;'>下一页</a>&nbsp;&nbsp;&nbsp;";	
	
	}
   }else
    if($page==$page_count){
      echo "&nbsp;&nbsp;<a href='?page=".$last."' style='text-decoration:none; border: 1px solid;border-radius: 5px; border-style: -6px; padding: 5px;  font-size:15px; color: #fc8b4a; float:left;'>上一页</a>&nbsp;&nbsp;&nbsp;";
    }else{
      echo "&nbsp;&nbsp;<a href='?page=".$last."' style='text-decoration:none; width: 47px;border: 1px solid;border-radius: 5px; border-style: -6px; padding: 5px;color: #fc8b4a;font-weight: 600; float:left; font-size: 14px;'>上一页</a>&nbsp;&nbsp;&nbsp;";
      echo "<a href='?page=".$next."' style='text-decoration:none; width: 47px;border: 1px solid;border-radius: 5px; border-style: -6px; padding: 5px;color: #fc8b4a;font-weight: 600;font-size: 14px; float:right;'>下一页</a>&nbsp;&nbsp;&nbsp;"; 
    }
  ?>
		
		
    </div>
	
	
	
	
	
	<script type="text/javascript" src="/ui/xianzhi/js/jquery.min.js"></script>
    <script type="text/javascript" src="/ui/script/H.js"></script>
    <script type="text/javascript" src="/ui/layer/mobile/layer.js"></script>  
	
	
	<style type="text/css">
    a {
    width: 50px;
}
  </style>

	   <script>
  
  function del(a){
		var goodid=a;
		var uid='<?=$_COOKIE['userid']?>';
	
	
	  layer.open({
    content: '确定删除后订单将无法恢复？'
    ,btn: ['确定', '取消']
    ,yes: function(index){
		
    $.ajax({
        url: './delall.php',
        type: 'POST',
        dataType: 'json',
        data: {goodid: goodid,
		uid:uid},
      });
	  
	  layer.open({
    content: '删除成功'
    ,skin: 'msg'
    ,time: 2 
  });
	location.reload();  		
	
      layer.close(index);
    }
  });
	
	
	

	  
	  
	  
  }	
  
  </script>
</body>
</html>